﻿using ChineseSchool.Models.Hethong;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ChineseSchool.BLL
{
    public class B_Homework
    {
        private PetaPoco.Database db;
        public B_Homework()
        {
            db = new PetaPoco.Database("ConnectionString");
        }

        public List<M_Homework> GetFilesOfLesson(int lessonId)
        {
            var strSql = @"SELECT * FROM Homework WHERE LessonId = '" + lessonId + "'";
            var lstFile = db.Fetch<M_Homework>(strSql);
            return lstFile;
        }

        public M_Homework GetByPk(int id)
        {
            var strSql = @"SELECT * FROM Homework WHERE HomeworkId = '" + id + "'";
            return db.FirstOrDefault<M_Homework>(strSql);
            
        }
    }
}